//
//  UserDataApi.m
//  SeaMelonSeeds_Counselor
//
//  Created by 尤振宇 on 2017/8/21.
//  Copyright © 2017年 杨笑. All rights reserved.
//

#import "UserDataApi.h"

@implementation UserDataApi
{
    NSString *_url;
    NSDictionary *_argument;
    YTKRequestMethod _method;
}

- (instancetype)initRequestProfileWithUserID:(int)user_id
{
    self = [super init];
    if (self) {
        _url = [NSString stringWithFormat:@"user/profile/%d",user_id];
        _argument = @{@"user_id":@(user_id)};
        _method = YTKRequestMethodGET;
    }
    return self;
}

- (instancetype)initRequestGaugeWithUserID:(int)user_id
{
    self = [super init];
    if (self) {
        _url = @"user/gauge";
        _argument = @{@"user_id":@(user_id),@"page":@(self.page),@"per_page":@"30"};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

- (instancetype)initRequestConsultWithOrderID:(int)orderID
{
    self = [super init];
    if (self) {
        _url = @"user/consult";
        _argument = @{@"consult_order_id":@(orderID),@"page":@(self.page),@"per_page":@"30"};
        _method = YTKRequestMethodPOST;
    }
    return self;
}

-(NSString *)requestUrl
{
    return _url;
}

-(id)requestArgument
{
    return _argument;
}

-(YTKRequestMethod)requestMethod
{
    return _method;
}


-(void)setPage:(int)page
{
    [super setPage:page];
    if ([_argument objectForKey:@"page"]) {
        NSMutableDictionary *dic = [[NSMutableDictionary alloc]initWithDictionary:_argument];
        [dic setObject:@(page) forKey:@"page"];
        _argument = dic;
    }
}
@end

@implementation UserData

@end

@implementation ConsultLogResult
-(void)setValue:(id)value forKey:(NSString *)key
{
    if ([key isEqualToString:@"description"]) {
        self.problemDescription = value;
    }else{
        [super setValue:value forKey:key];
    }
}
@end




